package com.prs.crm.domain.crm;

import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.annotation.DomainRelation;
import com.prs.crm.annotation.DomainRelations;
import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.FlowCodeEntity;
import com.prs.crm.domain.sys.Code;

@Entity
@Table(name="crm_customer")
@DomainRelations(relations={@DomainRelation(rely="com.prs.crm.domain.crm.Liaison",property="customer")})
public class Customer extends FlowCodeEntity{
	
	private static final long serialVersionUID = 1L;
	
	@Id@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	private String name;
	@ManyToOne
	private CustomerType type;
	private String customercode;
	@ManyToOne
	private CustomerLevel level;
	@ManyToOne
	private CustomerTrade trade;
	
	private String merit;
	@ManyToOne
	private CustomerAddress address;  //关联地址区域
	@ManyToOne
	private CustomerSource source;  //客户来源
	@ManyToOne
	private CustomerDegree degree;  //重要程度
	@ManyToOne
	private CustomerSales sales;  //销售组
	@Lob
	//private String address;
	private String url;
	private String linkman;
	private String dept;
	private String role;
	private String sex;
	private Date birthday;
	private String nativePlace;
	private String officePhone;
	private String fax;
	private String mobileNo;
	private String QQ_No;
	private String MSN_No;
	private String email;
	private String postcode;  //邮政编码
	private String lawPerson;
	private String regCapital;
	private String latlng;
	
	private String addressT;  //通讯地址
	private String web;  //单位网站
	private String year;  //年营业额
	private String sharePerson;  //共享人员
	private String person;  //业务人员
	
	private String personCount;
	@Lob
	private String synopsis;
	@Lob
	private String actuality;
	@Lob
	private String foreground;
	@Lob
	private String strategy;
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Attachment attach;
	@Column(name="customer_file")
	private String customer_file;
	@Lob
	private String remark;
	private String depositBank1;
	private String depositName1;
	private String bankAccount1;
	private String taxNo1;
	private String depositBank2;
	private String depositName2;
	private String bankAccount2;
	private String taxNo2;
	private String state;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="customer")
	private Set<CustomerAppoint> appoints;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="customer")
	private Set<Liaison> liaisons;
	//跟单
	@OneToMany(fetch=FetchType.LAZY,mappedBy="customer")
	private Set<DocumenTary> documenTarys;
	//联系人
	@OneToMany(fetch=FetchType.LAZY,mappedBy="customer")
	private Set<Linkman> linkmans;
	//项目
	@OneToMany(fetch=FetchType.LAZY,mappedBy="customer")
	private Set<CustomerProject> projects;
	
	//关联代理商
	@ManyToOne
	private CustomerAgent customerAgent;
	//关联供应商
	@ManyToOne
	private CustomerSupplier customerSupplier;
	
	
	public CustomerSupplier getCustomerSupplier() {
		return customerSupplier;
	}
	public void setCustomerSupplier(CustomerSupplier customerSupplier) {
		this.customerSupplier = customerSupplier;
	}
	public CustomerAgent getCustomerAgent() {
		return customerAgent;
	}
	public void setCustomerAgent(CustomerAgent customerAgent) {
		this.customerAgent = customerAgent;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public CustomerType getType() {
		return type;
	}
	public void setType(CustomerType type) {
		this.type = type;
	}
	
	public String getCustomercode() {
		return customercode;
	}
	public void setCustomercode(String customercode) {
		this.customercode = customercode;
	}
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}
	public CustomerLevel getLevel() {
		return level;
	}
	public void setLevel(CustomerLevel level) {
		this.level = level;
	}
	public CustomerTrade getTrade() {
		return trade;
	}
	public void setTrade(CustomerTrade trade) {
		this.trade = trade;
	}
	public String getMerit() {
		return merit;
	}
	public void setMerit(String merit) {
		this.merit = merit;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getLinkman() {
		return linkman;
	}
	public void setLinkman(String linkman) {
		this.linkman = linkman;
	}
	public String getDept() {
		return dept;
	}
	public void setDept(String dept) {
		this.dept = dept;
	}
	public String getRole() {
		return role;
	}
	public void setRole(String role) {
		this.role = role;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getNativePlace() {
		return nativePlace;
	}
	public void setNativePlace(String nativePlace) {
		this.nativePlace = nativePlace;
	}
	public String getOfficePhone() {
		return officePhone;
	}
	public void setOfficePhone(String officePhone) {
		this.officePhone = officePhone;
	}
	public String getFax() {
		return fax;
	}
	public void setFax(String fax) {
		this.fax = fax;
	}
	public String getMobileNo() {
		return mobileNo;
	}
	public void setMobileNo(String mobileNo) {
		this.mobileNo = mobileNo;
	}
	public String getQQ_No() {
		return QQ_No;
	}
	public void setQQ_No(String qQNo) {
		QQ_No = qQNo;
	}
	public String getMSN_No() {
		return MSN_No;
	}
	public void setMSN_No(String mSNNo) {
		MSN_No = mSNNo;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getPostcode() {
		return postcode;
	}
	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}
	public String getLawPerson() {
		return lawPerson;
	}
	public void setLawPerson(String lawPerson) {
		this.lawPerson = lawPerson;
	}
	public String getRegCapital() {
		return regCapital;
	}
	public void setRegCapital(String regCapital) {
		this.regCapital = regCapital;
	}
	public String getPersonCount() {
		return personCount;
	}
	public void setPersonCount(String personCount) {
		this.personCount = personCount;
	}
	public String getSynopsis() {
		return synopsis;
	}
	public void setSynopsis(String synopsis) {
		this.synopsis = synopsis;
	}
	public String getActuality() {
		return actuality;
	}
	public void setActuality(String actuality) {
		this.actuality = actuality;
	}
	public String getForeground() {
		return foreground;
	}
	public void setForeground(String foreground) {
		this.foreground = foreground;
	}
	public String getStrategy() {
		return strategy;
	}
	public void setStrategy(String strategy) {
		this.strategy = strategy;
	}

	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public String getDepositBank1() {
		return depositBank1;
	}
	public void setDepositBank1(String depositBank1) {
		this.depositBank1 = depositBank1;
	}
	public String getDepositName1() {
		return depositName1;
	}
	public void setDepositName1(String depositName1) {
		this.depositName1 = depositName1;
	}
	public String getBankAccount1() {
		return bankAccount1;
	}
	public void setBankAccount1(String bankAccount1) {
		this.bankAccount1 = bankAccount1;
	}
	public String getTaxNo1() {
		return taxNo1;
	}
	public void setTaxNo1(String taxNo1) {
		this.taxNo1 = taxNo1;
	}
	public String getDepositBank2() {
		return depositBank2;
	}
	public void setDepositBank2(String depositBank2) {
		this.depositBank2 = depositBank2;
	}
	public String getDepositName2() {
		return depositName2;
	}
	public void setDepositName2(String depositName2) {
		this.depositName2 = depositName2;
	}
	public String getBankAccount2() {
		return bankAccount2;
	}
	public void setBankAccount2(String bankAccount2) {
		this.bankAccount2 = bankAccount2;
	}
	public String getTaxNo2() {
		return taxNo2;
	}
	public void setTaxNo2(String taxNo2) {
		this.taxNo2 = taxNo2;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getState() {
		return state;
	}
	public void setAppoints(Set<CustomerAppoint> appoints) {
		this.appoints = appoints;
	}
	public Set<CustomerAppoint> getAppoints() {
		return appoints;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setLiaisons(Set<Liaison> liaisons) {
		this.liaisons = liaisons;
	}
	public Set<Liaison> getLiaisons() {
		return liaisons;
	}
	public String getLatlng() {
		return latlng;
	}
	public void setLatlng(String latlng) {
		this.latlng = latlng;
	}
	public String getCustomer_file() {
		return customer_file;
	}
	public void setCustomer_file(String customerFile) {
		customer_file = customerFile;
	}
	public Set<DocumenTary> getDocumenTarys() {
		return documenTarys;
	}
	public void setDocumenTarys(Set<DocumenTary> documenTarys) {
		this.documenTarys = documenTarys;
	}
	public Set<Linkman> getLinkmans() {
		return linkmans;
	}
	public void setLinkmans(Set<Linkman> linkmans) {
		this.linkmans = linkmans;
	}
	public Set<CustomerProject> getProjects() {
		return projects;
	}
	public void setProjects(Set<CustomerProject> projects) {
		this.projects = projects;
	}
	public String getAddressT() {
		return addressT;
	}
	public void setAddressT(String addressT) {
		this.addressT = addressT;
	}
	public String getWeb() {
		return web;
	}
	public void setWeb(String web) {
		this.web = web;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public String getPerson() {
		return person;
	}
	public void setPerson(String person) {
		this.person = person;
	}
	public CustomerAddress getAddress() {
		return address;
	}
	public void setAddress(CustomerAddress address) {
		this.address = address;
	}
	public CustomerSource getSource() {
		return source;
	}
	public void setSource(CustomerSource source) {
		this.source = source;
	}
	public CustomerDegree getDegree() {
		return degree;
	}
	public void setDegree(CustomerDegree degree) {
		this.degree = degree;
	}
	public CustomerSales getSales() {
		return sales;
	}
	public void setSales(CustomerSales sales) {
		this.sales = sales;
	}
	public String getSharePerson() {
		return sharePerson;
	}
	public void setSharePerson(String sharePerson) {
		this.sharePerson = sharePerson;
	}
	
}
